import Vue from 'vue'
import Vuex from 'vuex'

//挂载vuex
Vue.use(Vuex);

 const  store = new Vuex.Store({
  //存放的键值对就是要管理的状态等同于data
  state: {
    grades: "",
    courses:[],
    coursestarts:[],
    courseings:[],
    courseends:[],
    collectionstarts:[],
    user:{},
    student:{},
    orders:[],
    orderrefunds:[],
    orderSuccess:[],
    teacher:[],
    allmoney:'',
    courselive:[],
    addcourse:{}

  },
  mutations: {
    add(state) {
      console.log("Sadsadsa")
    },

    //参数2是用户传递的数据
    setGrades(state, data) {
      state.grades = data;
    },
    setCourses(state,data){
      state.courses = data;
    },
    setCoursestarts(state,data){
      state.coursestarts = data;
    },
    setCourseings(state,data){
      state.courseings = data;
    },
    setCourseends(state,data){
      state.courseends = data;
    },
    setCollectionstarts(state,data){
      state.collectionstarts = data;
    },
    setUser(state,data){
        state.user = data;
    },
    setStudent(state,data){
      state.student = data;
    },
    setOrders(state,data){
      state.orders = data;
    },
      setOrderrefunds(state,data){
        state.orderrefunds = data;
    },
    setOrderSuccess(state,data){
      state.orderSuccess = data;
    },
    setTeacher(state,data){
      state.teacher = data;
    },
    setAllmoney(state,data){
      state.allmoney = data;
    },
    setCourseslive(state,data){
      state.courselive = data;
    },
    addCourse(state,data){
      state.addcourse = data;
    },
    addCoursesection(state,data){
      state.addcoursesection = data;
    }
  }
})

export default store;
